import 'package:casdon/common/state/common_net_status.dart';
import 'package:casdon/modules/login/domain/states/login_code_state.dart';
import 'package:casdon/modules/login/domain/states/login_state.dart';

// 标记此时发送的验证码的页面，如果是accountPage则发送完成进入验证码输入页，如果是codePage 发送完成则开始计时

// 标记重置密码流程此时的步骤
enum DelAccountStep { sendCode, verifyCode, delAccount }

class DelAccountState extends LoginState {
  final String? account;
  final String? code;
  final SendCodeSource source;

  // ✅ 私有标记对象
  static const Object _sentinel = Object();

  DelAccountState({
    required super.status,
    super.message,
    required super.version,
    super.agreed,
    this.account,
    this.code,
    super.errorCode,
    this.source = SendCodeSource.accountPage,
  });

  factory DelAccountState.initial() => DelAccountState(
    status: CommonNetStatus.idle,
    version: 1,
    agreed: false,
    account: null,
    code: null,
    errorCode: null,
    source: SendCodeSource.accountPage,
  );

  @override
  DelAccountState copyWith({
    Object? status = _sentinel,
    Object? message = _sentinel,
    Object? version = _sentinel,
    Object? account = _sentinel,
    Object? code = _sentinel,
    Object? agreed = _sentinel,
    Object? source = _sentinel,
    Object? errorCode = _sentinel,
  }) {
    return DelAccountState(
      status: status == _sentinel
          ? this.status
          : status as CommonNetStatus? ?? this.status,
      message: message == _sentinel ? this.message : message as String?,
      version: version == _sentinel
          ? this.version
          : version as int? ?? this.version,
      agreed: agreed == _sentinel
          ? this.agreed
          : agreed as bool? ?? this.agreed,
      errorCode: errorCode == _sentinel ? this.errorCode : errorCode as String?,
      account: account == _sentinel ? this.account : account as String?,
      code: code == _sentinel ? this.code : code as String?,
      source: source == _sentinel ? this.source : source as SendCodeSource,
    );
  }
}
